<?php
namespace Admin\Controller;
use Think\Controller;
/**
 *
订单控制器 2016-11-09 @auth:姚飞
*/

class OrderController extends Controller
{
    // 订单首页
    public function index()
    {
        $order = D('Order');
        $data1 = $order->join('user on order.uid = user.user_id')->where("order.status = '0'")->select();
        $data2 = $order->join('user on order.uid = user.user_id')->where("order.status = '1'")->select();
        $data3 = $order->join('user on order.uid = user.user_id')->where("order.status = '2'")->select();
        $data4 = $order->join('user on order.uid = user.user_id')->where("order.status = '3'")->select();
        // echo"<pre>";
        // var_dump($data2);
        // echo"<pre/>";
        $this->assign('title','订单列表');
        $this->assign('list1',$data1);
        $this->assign('list2',$data2);
        $this->assign('list3',$data3);
        $this->assign('list4',$data4);
        $this->display();
    }



    public function post(){

        
        if (empty($_POST['order_id'])) {
            
             $this->ajaxReturn('发货失败');
        }

        $data  =['status'=>2];

        $order = D('order');


        if ($order->where('id='.I('post.order_id'))->save($data)>0) {
            

             $this->ajaxReturn("已发货");
          
        }else{

             $this->ajaxReturn('发货失败');
        }

        
        

    }

    
}